﻿Imports System.Data.SqlClient
Imports System.Configuration
Public Class frm_giaovien
    Dim tb As New DataTable
    Sub loadgv()
        Dim cmd As New SqlCommand("sp_giaovien_lenluoi", conn)
        cmd.CommandType = CommandType.StoredProcedure

        Dim da As New SqlDataAdapter(cmd)
        Dim tb1 As New DataTable
        tb = tb1
        da.Fill(tb1)
        dgv_dsgv.DataSource = tb1
    End Sub
    Private Sub frm_giaovien_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
        loadgv()
    End Sub

    Private Sub cmd_timgv_Click(sender As System.Object, e As System.EventArgs) Handles cmd_timgv.Click
        If cbo_chon.SelectedIndex < 0 Then
            MsgBox("Vui lòng chọn mục cần tìm ")
            Exit Sub
        End If
        If cbo_chon.SelectedIndex = 0 Then
            tb.DefaultView.RowFilter = String.Format("MaGiaoVien like '%{0}'", txt_timgv.Text)
        End If
        If cbo_chon.SelectedIndex = 1 Then
            tb.DefaultView.RowFilter = String.Format("TenGiaoVien like '%{0}'", txt_timgv.Text)
        End If
    End Sub
End Class